/*
 * @Description: 
 * @Author: IA ia@ker.center
 * @Date: 2025-03-14 09:16:20
 */


process.stdout.setEncoding('utf-8');

import type { Express, Request, Response, Router } from 'express'
import type { RouterConf } from './types'

import routes from './routes'


// 路由配置
const routeList: Array<RouterConf> = routes || []

function router(app: Express) {
    // 根目录
    app.get('/', async (req: Request, res: Response) => {
        res.send("Express Mock Service Running !")
    })

    routeList.forEach((route) => {
        return app.use(route.path, route.router)
    })
}

export default router